﻿// Creado por Sergio. 02/06/10

#region Using Statements
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
#endregion

namespace Game
{

    /// <summary>
    /// Clase que contiene la informacion de la vida de personajes, enemigos, etc.
    /// </summary>
    public class Life
    {
        int mHealthPoints = 0; // vida actual
        int mPrevHealthPoints = 0; // vida previa
        bool isAlive = false; // esta vivo?

        public Life(int healthPoints)
        {
            if (healthPoints > 0)
            {
                mHealthPoints = healthPoints;
                isAlive = true;
            }
        }

        public int HealthPoints
        {
            get { return mHealthPoints; }
            set
            {
                mPrevHealthPoints = mHealthPoints;
                mHealthPoints = value;
                if (mHealthPoints < 0)
                    mHealthPoints = 0;
                if (mHealthPoints == 0)
                    isAlive = false;
            }
        }

        public int PrevHealthPoints
        {
            get { return mPrevHealthPoints; }
            set { mPrevHealthPoints = value; }
        }

        public bool IsAlive
        {
            get { return isAlive; }
            set { isAlive = value; }
        }

    }
}
